// CSE 142 Winter 2008, Marty Stepp // This client program uses our Point class. public class PointMain { public static void main(String[] args) { // create two Point objects Point p1 = new Point(); p1.x = 1; p1.y = 2; Point p2 = new Point(); p2.x = 4; p2.y = -7; System.out.println("p1 is (" + p1.x + ", " + p1.y + ")"); System.out.println("p2 is (" + p2.x + ", " + p2.y + ")"); // move the points, then print them again // p1.x = p1.x - 2; // p1.y = p1.y - 1; // Point.translate(p1, -2, -1); p1.translate(-2, -1); // p2.x = p2.x + 2; // p2.y = p2.y + 1; // Point.translate(p2, 2, 1); p2.translate(2, 1); System.out.println("p1 is (" + p1.x + ", " + p1.y + ")"); System.out.println("p2 is (" + p2.x + ", " + p2.y + ")"); System.out.println("p1's distance from origin: " + p1.distanceFromOrigin()); System.out.println("p2's distance from origin: " + p2.distanceFromOrigin()); } }